From: Owen W. Taylor Date: Wed, 10 Mar 2010 18:57:05 +0000 (-0500) Subject: Fixes for setting up scrolling adjustments X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~10330 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c83883f1f747195effababbbbd31bc4b4ea4a5d4;p=gnome-shell.git Fixes for setting up scrolling adjustments StScrollable: Document how to set adjustments StBoxLayout: Make sure that we always have upper >= lower + page_size, so that clamping works properly. Set the page_increment to be slightly less than the page_size so there is some overlap, as is customary. StScrollView: Remove unnecessary fabs() calls, rewrite expressions for additional clarity. https://bugzilla.gnome.org/show_bug.cgi?id=611740 --- diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c index 17690f5e4..96013e3a3 100644 --- a/src/st/st-box-layout.c +++ b/src/st/st-box-layout.c @@ -770,10 +770,10 @@ st_box_layout_allocate (ClutterActor *actor, g_object_set (G_OBJECT (priv->vadjustment), "lower", 0.0, - "upper", min_height, + "upper", MAX (min_height, avail_height), "page-size", avail_height, "step-increment", avail_height / 6, - "page-increment", avail_height, + "page-increment", avail_height - avail_height / 6, NULL); prev_value = st_adjustment_get_value (priv->vadjustment); @@ -786,10 +786,10 @@ st_box_layout_allocate (ClutterActor *actor, g_object_set (G_OBJECT (priv->hadjustment), "lower", 0.0, - "upper", min_width, + "upper", MAX (min_width, avail_width), "page-size", avail_width, "step-increment", avail_width / 6, - "page-increment", avail_width, + "page-increment", avail_width - avail_width / 6, NULL); prev_value = st_adjustment_get_value (priv->hadjustment); diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c index 4c3a8a28a..f3e244bbe 100644 --- a/src/st/st-scroll-view.c +++ b/src/st/st-scroll-view.c @@ -171,8 +171,8 @@ update_shadow_visibility (StScrollView *scroll) st_adjustment_get_values (priv->vadjustment, &value, &lower, &upper, NULL, NULL, &page_size); - priv->top_shadow_visible = fabs (value - lower) > 0.1; - priv->bottom_shadow_visible = fabs (upper - value - page_size) > 0.1; + priv->top_shadow_visible = value > lower + 0.1; + priv->bottom_shadow_visible = value < upper - page_size - 0.1; } else { diff --git a/src/st/st-scrollable.c b/src/st/st-scrollable.c index 38a25b199..d9fa3e8b5 100644 --- a/src/st/st-scrollable.c +++ b/src/st/st-scrollable.c @@ -66,8 +66,16 @@ * resize the scroll view small enough so that the scrolled area * vanishes. * - * width-for-height size negotation is similar, with the roles of width - * and height reversed. + * In response to allocate, in addition to normal handling, the + * scrollable should also set the limits of the the horizontal and + * vertical adjustments that were set on it earlier. The standard + * settings are: + * + * lower: 0 + * page_size: allocated size (width or height) + * upper: MAX (total size of the scrolled area,allocated_size) + * step_increment: natural row/column height or a fixed fraction of the page size + * page_increment: page_size - step_increment */ static void st_scrollable_base_init (gpointer g_iface)